package cn.dust.design.pattern.structural.flyweight.piece;

import java.util.Hashtable;

public class  IgoChessmanFactory {
    private static IgoChessmanFactory instance=new IgoChessmanFactory();
    private static Hashtable hashtable;

    private IgoChessmanFactory(){
        hashtable=new Hashtable();
        IgoChessman black,white;
        black=new BlackIgoChessman();
        hashtable.put("b",black);
        white=new WhiteIgoChessman();
        hashtable.put("w",white);
    }

    public static IgoChessmanFactory getInstance(){
        return instance;
    }

    public static IgoChessman getIgoChessman(String color){
        return (IgoChessman)hashtable.get(color);
    }

}
